package cn.enited.devtools.apiaggregator.dto;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Accessors(chain = true)
public class ObjectActionResult<T> extends ActionResult {
    private static final long serialVersionUID = -7820264488511551251L;

    private T data;

    public ObjectActionResult(int code, String message, T data) {
        super(code, message);
        this.data = data;
    }

    public ObjectActionResult() {
    }

    public ObjectActionResult(int code, String message) {
        super(code, message);
    }

    public static <T> ObjectActionResult<T> of(int code, String message, T data) {
        return new ObjectActionResult<>(code, message, data);
    }
}
